//
//  CollectionViewCell.m
//  CarHome
//
//  Created by 苗钧豪 on 16/8/9.
//  Copyright © 2016年 苗钧豪. All rights reserved.
//

#import "CollectionViewCell.h"
#import "HotCar.h"
@implementation CollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _imgview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height - 50)];
        [self addSubview:_imgview];
        _namelabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.bounds.size.height - 30, self.bounds.size.width, 30)];
        _namelabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_namelabel];
    }
    return self;
}
- (void)setHotcar:(HotCar *)hotcar {
    _hotcar = hotcar;
    NSURL *url = [NSURL URLWithString:_hotcar.img];
    NSData *data = [NSData dataWithContentsOfURL:url];
    _imgview.image = [UIImage imageWithData:data];
    _namelabel.text = _hotcar.name;
}
@end
